<%--***************************************
*
快钱
@version 2.0
 
***************************************--%>
<%@ page import="
	java.util.*,
	java.text.*,
	com.probiz.estore.payment.bill99.MD5Util,
	com.probiz.estore.common.model.order.SalesOrder,
	com.probiz.estore.common.model.system.PaymentGateway,
	com.probiz.estore.common.helper.ConfigUtil,
	com.probiz.estore.core.util.StringUtil"
	contentType="text/html; charset=UTF-8"%>
	
<%
	SalesOrder salesOrder=(SalesOrder)request.getAttribute("salesOrder");
	PaymentGateway paymentGateway=(PaymentGateway)request.getAttribute("paymentGateway");
	request.setAttribute("paymentGateway",paymentGateway);
	HashMap paramMap = paymentGateway.getConfigData();
	
	//-----------------------start: 账户信息------------------------------------------
	String merchantAcctId ="";
	String key = "";					
	if (paramMap != null) {
		merchantAcctId = paramMap.get("merchant_id").toString().trim(); 		//商户号
		key = paramMap.get("key").toString().trim(); 		//人民币账号
	}
	//-----------------------end:   账户信息------------------------------------------
	
	//-----------------------start: 配置信息------------------------------------------
	String bgUrl = ConfigUtil.getInstance().getStoreFrontSiteUrl()
					+"/system/payment/99bill_response.html";									//服务器接受支付结果的后台地址
	String inputCharset = "1";																	//固定选择值：1、2、3   1 代表UTF-8; 2 代表GBK; 3 代表GB2312默认值为1
	String version = "v2.0";																	//快钱的版本，目前  v2.0
	String language = "1"; 																		//固定值：1;1 代表中文显示
	String signType = "1";																		//固定值：1;1 代表MD5 加密签名方式
	//-----------------------end:   配置信息------------------------------------------
	
	//-----------------------start: 业务信息------------------------------------------
	String payerName = salesOrder.getCustomerFullName().trim();									//支付人名字
	String payerContactType = "1";																//联系人联系方式 ：固定值：1 代表电子邮件方式
	String payerContact = salesOrder.getCustomerEmail().trim();									//邮件地址
	String orderId = salesOrder.getOrderNo().trim();											//商户订单号 
	String orderAmount = new DecimalFormat("0").format(salesOrder.getUnPaidAmount().doubleValue()*100).trim(); //整型数字以分为单位。比方10 元，提交时金额应为1000
	String orderTime = new SimpleDateFormat("yyyyMMddHHmmss").format(salesOrder.getCreateTime()).trim();	  //年月日时分秒字符串 不能为空 20071117020101
	String productName = salesOrder.getOrderNo().trim();										//商品名称
	String productNum = "1";																	//商品数量
	String productId = "";																		//商品Id
	String productDesc = "";																	//商品描述
	String ext1 = "";																			//扩展参数  可为空
	String ext2 = "";																			//扩展参数  可为空
	String payType = "00";																		//不能为空 固定选择值：00、10、11、12、13; 00 代表显示快钱各支付方式列表；
	String redoFlag = "0";																		//同一订单禁止重复提交标志 默认为0表示同一订单号在没有支付成功的前提下可重复提交多次。 
	String pid = "";																			//合作伙伴在快钱的用户编号 可为空
	
	String signMsgVal="";
	signMsgVal=StringUtil.appendParam(signMsgVal,"inputCharset",inputCharset);
	signMsgVal=StringUtil.appendParam(signMsgVal,"bgUrl",bgUrl);
	signMsgVal=StringUtil.appendParam(signMsgVal,"version",version);
	signMsgVal=StringUtil.appendParam(signMsgVal,"language",language);
	signMsgVal=StringUtil.appendParam(signMsgVal,"signType",signType);
	signMsgVal=StringUtil.appendParam(signMsgVal,"merchantAcctId",merchantAcctId);
	signMsgVal=StringUtil.appendParam(signMsgVal,"payerName",payerName);
	signMsgVal=StringUtil.appendParam(signMsgVal,"payerContactType",payerContactType);
	signMsgVal=StringUtil.appendParam(signMsgVal,"payerContact",payerContact);
	signMsgVal=StringUtil.appendParam(signMsgVal,"orderId", orderId);
	signMsgVal=StringUtil.appendParam(signMsgVal,"orderAmount",orderAmount);
	signMsgVal=StringUtil.appendParam(signMsgVal,"orderTime", orderTime);
	signMsgVal=StringUtil.appendParam(signMsgVal,"productName",productName);
	signMsgVal=StringUtil.appendParam(signMsgVal,"productNum",productNum);
	signMsgVal=StringUtil.appendParam(signMsgVal,"productId",productId);
	signMsgVal=StringUtil.appendParam(signMsgVal,"productDesc",productDesc);
	signMsgVal=StringUtil.appendParam(signMsgVal,"ext1",ext1);
	signMsgVal=StringUtil.appendParam(signMsgVal,"ext2",ext2);
	signMsgVal=StringUtil.appendParam(signMsgVal,"payType",payType);
	signMsgVal=StringUtil.appendParam(signMsgVal,"redoFlag",redoFlag);
	signMsgVal=StringUtil.appendParam(signMsgVal,"pid",pid);
	signMsgVal=StringUtil.appendParam(signMsgVal,"key",key);
	String signMsg = MD5Util.md5Hex(signMsgVal.trim().getBytes("UTF-8")).toUpperCase();        //签名字符串 不能空
	
	//-----------------------end:   业务信息------------------------------------------
	
%>
<div style="display:none">
	<form name="paymentGatewayForm" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm">
		<input type="hidden" name="inputCharset" value="<%=inputCharset%>"/>
		<input type="hidden" name="bgUrl" value="<%=bgUrl%>"/>
		<input type="hidden" name="version" value="<%=version%>"/>
		<input type="hidden" name="language" value="<%=language%>"/>
		<input type="hidden" name="signType" value="<%=signType%>"/>
  		<input type="hidden" name="merchantAcctId" value="<%=merchantAcctId%>" />
		<input type="hidden" name="payerName" value="<%=payerName%>"/>
		<input type="hidden" name="payerContactType" value="<%=payerContactType%>"/>
		<input type="hidden" name="payerContact" value="<%=payerContact%>"/>
		<input type="hidden" name="orderId" value="<%=orderId%>" />
		<input type="hidden" name="orderAmount" value="<%=orderAmount%>" />
		<input type="hidden" name="orderTime" value="<%=orderTime%>"/>
		<input type="hidden" name="productName" value="<%=productName%>"/>
		<input type="hidden" name="productNum" value="<%=productNum%>"/>
		<input type="hidden" name="productId" value="<%=productId%>"/>
		<input type="hidden" name="productDesc" value="<%=productDesc%>"/>
		<input type="hidden" name="ext1" value="<%=ext1%>"/>
		<input type="hidden" name="ext2" value="<%=ext2%>"/>
		<input type="hidden" name="payType" value="<%=payType%>"/>
		<input type="hidden" name="redoFlag" value="<%=redoFlag%>"/>
		<input type="hidden" name="pid" value="<%=pid%>"/>
		<input type="hidden" name="signMsg" value="<%=signMsg%>"/>
	</form> 
</div>
<script type="text/javascript">
$j(document).ready(function () {
	document.forms["paymentGatewayForm"].submit();
});
</script>

<%@ include file="./include/payOrderTips.jspf" %>